home *** CD-ROM | disk | FTP | other *** search
- { TPBoard 4.2 Copyright (c) 1987,88 by Jon Schneider & Rick Petersen
- Portions Copyright (c) 1986,87 by Steve Fox and Les Archambault
-
- Last modified :: 7-23-88 5:13 pm
- }
-
- {$R-} {Range checking off}
- {$B-} {Boolean complete evaluation off}
- {$S-} {Stack checking off}
- {$I+} {I/O checking on}
- {$N-} {No numeric coprocessor}
-
- Unit FileMnu2;
-
- Interface
-
- Uses
- TPCrt, Dos, Globals, TAccess, Core1,
- Core2, TPSTRING, TPDOS, Exdate;
-
-
- procedure files_list;
-
- procedure newin_list(mode : Char);
-
-
- {==========================================================================}
-
-
- Implementation
-
-
- procedure files_list;
- { List files in current section }
-
- var
- line_count,
- not_found : Integer;
- Str : string;
- i : LongInt;
- SectionStr : DosFileName;
- Dirspec : StrPr;
- TmpDrv : Str3;
- key, SearchKey,
- fname : DosFileName;
- still_in_newin : Boolean;
-
-
- procedure display_record;
-
- begin
- with nwin_rec do
- begin
- WriteLn(Com);
- not_found := 0;
- Str := yellow+hi+pad(name, 15)+white+intstr(date[4], 2)+'/'+
- intstr(date[3], 2)+'/'+intstr(date[5], 2)+yellow;
- Write(Com, Str);
- if CreditType = Points then
- WriteLn(Com, ' Cost: ', PointValue, ' Points')
- else
- WriteLn(Com, ' Downloads: ', dnloads);
- WriteLn(Com, cyan, ' ', descr);
- if (user_rec.lines <> 99) then
- begin
- Inc(line_count);
- if line_count mod (user_rec.lines div 3) = 0 then
- pause;
- end;
- end;
- end;
-
-
- begin
- abort := False;
- line_count := 0;
- fname := '';
- WriteLn(Com);
- if ask('Search for file(s)', 'N') then
- begin
- fname := prompt('Filename (partial name OK) >', 12, 'ES');
- if Pos('*', fname) <> 0 then
- begin
- Delete(fname, Pos('*', fname), 12);
- WriteLn(Com, 'Use partial names, not wildcards.');
- end;
- end;
- if SectReq = 'NEWIN' then
- begin
- SectionStr := 'NEWIN';
- FindSect(SectionStr, TmpDrv, OK);
- Dirspec := TmpDrv;
- if (Length(HomName) > 3) and (Dirspec = HomDrv) then
- begin
- Dirspec := Dirspec+Copy(HomName, 4, Length(HomName));
- Dirspec := Dirspec+'\'
- end;
- Dirspec := Dirspec+'NEWIN';
- not_found := 0;
- i := Pred(FileSize(nwin_file));
- while (not brk) and (i >= 1) do
- begin
- Seek(nwin_file, i);
- Read(nwin_file, nwin_rec);
- with nwin_rec do
- begin
- still_in_newin := ExistFile(Dirspec+'\'+name);
- if (status = public) and (still_in_newin) and
- ((fname = ' ') or (Pos(fname, name) = 1)) then
- display_record
- else
- begin
- if (not still_in_newin) then
- Inc(not_found);
- if not_found > 50 then
- i := 1;
- end;
- end;
- i := Pred(i);
- end;
- if FileSize(nwin_file) = 0 then
- begin
- WriteLn(Com);
- WriteLn(Com, 'Newin List is empty.');
- WriteLn(Com);
- end;
- end
- else
- begin
- SearchKey := SectReq;
- key := SectReq;
- FindKey(NewinArea, i, key);
- if OK then
- begin
- repeat
- Seek(nwin_file, i);
- Read(nwin_file, nwin_rec);
- SetSect(SetName);
- if (nwin_rec.status = public) and ExistFile(nwin_rec.name)
- and ((fname = ' ') or (Pos(fname, nwin_rec.name) = 1)) then
- display_record;
- SetSect(HomName);
- NextKey(NewinArea, i, key);
- until (not OK) or (key <> SearchKey) or brk;
- Write(Com, cyan);
- end
- else
- begin
- WriteLn(Com);
- WriteLn(Com, 'No files listed for this section.');
- WriteLn(Com);
- end;
- end;
- end;
-
-
- procedure newin_list(mode : Char);
- { List new uploads }
-
- var
- i : LongInt;
- line_count,
- conf_num,
- new_days,
- past_new_days : Integer;
- Str : StrTAD;
- temp_user_rec : user_list;
- This : SectPtr;
- none_found : Boolean;
- fname,
- SectionStr,
- key : DosFileName;
- Dirspec : StrPr;
- TmpDrv : Str3;
- lines : Byte;
-
- begin
- fname := '';
- abort := False;
- SectionStr := 'NEWIN';
- FindSect(SectionStr, TmpDrv, OK);
- Dirspec := TmpDrv;
- if (Length(HomName) > 3) and (Dirspec = HomDrv) then
- begin
- Dirspec := Dirspec+Copy(HomName, 4, Length(HomName));
- Dirspec := Dirspec+'\'
- end;
- Dirspec := Dirspec+'NEWIN';
- none_found := True;
- past_new_days := 0;
- i := Pred(FileSize(nwin_file));
- WriteLn(Com);
- if mode = 'N' then
- begin
- Str := prompt('Days previous to check [CR = since last on] ', 4, 'EL');
- if Str <> '' then
- new_days := strint(Str)
- else
- new_days := Succ(day_diff(user_rec.laston[3], user_rec.laston[4],
- user_rec.laston[5]+1900, login_t[3], login_t[4], login_t[5]+1900));
- end
- else
- begin
- new_days := MaxInt;
- fname := prompt('Filename (partial name OK) ', 12, 'ES');
- if fname <> ' ' then
- begin
- if Pos('*', fname) <> 0 then
- begin
- Delete(fname, Pos('*', fname), 12);
- WriteLn(Com, 'Use partial names, not wildcards.');
- end;
- WriteLn(Com);
- key := fname;
- SearchKey(NewinName, i, key);
- if (Pos(fname, key) <> 1) or (not OK) then
- i := -1;
- end
- else
- i := -1;
- end;
- line_count := 0;
- OK := True;
- while (not brk) and (i >= 1) and (past_new_days < 20) do
- begin
- check_time;
- Seek(nwin_file, i);
- Read(nwin_file, nwin_rec);
- This := SectBase;
- with nwin_rec do
- begin
- if status = public then
- begin
- while (This <> nil) and (This^.SectName <> sectn) do
- This := This^.next;
- conf_num := This^.SectConf;
- if (user_rec.access >= This^.SectAccs) or (test_bit(user_rec.conf_flags,
- conf_num)) then
- begin
- OK := (day_diff(date[3], date[4], date[5]+1900, login_t[3],
- login_t[4], login_t[5]+1900) < new_days);
- if OK then
- past_new_days := 0
- else
- Inc(past_new_days);
- if OK then
- begin
- timer(time_on, time_left);
- none_found := False;
- Str := intstr(date[4], 2)+'/'+intstr(date[3], 2)+'/'+intstr(date
- [5], 2);
- if (user > 0) and (user <= FileLen(DatF)) then
- begin
- GetRec(DatF, user, temp_user_rec);
- if temp_user_rec.used <> 0 then
- begin
- temp_user_rec.fn := '';
- temp_user_rec.ln := '';
- end;
- end
- else
- begin
- temp_user_rec.fn := 'Unknown';
- temp_user_rec.ln := 'Sender';
- end;
- if (mode = 'N') then
- WriteLn(Com);
- if ExistFile(Dirspec+'\'+name) then
- SectionStr := 'NEWIN'
- else
- SectionStr := sectn;
- if mode = 'N' then
- begin
- Write(Com, hi, yellow, pad(name, 15), SectionStr,
- ' Section ', Str, ' ');
- WriteLn(Com, temp_user_rec.fn, ' ',
- temp_user_rec.ln);
- Str := intstr(last_dnload[4], 2)+'/'+
- intstr(last_dnload[3], 2)+'/'+intstr(last_dnload[5], 2);
- Write(Com, white, 'Downloads ', dnloads, ' Last download ',
- Str, cyan);
- if CreditType = Points then
- Write(Com, ' Points ', PointValue);
- WriteLn(Com);
- WriteLn(Com, ' ', descr);
- end
- else
- WriteLn(Com, yellow, pad(name, 15), green, ' Location: ',
- yellow, SectionStr, cyan);
- if (user_rec.lines <> 99) then
- begin
- Inc(line_count);
- if mode = 'N' then
- lines := 4
- else
- lines := 1;
- if line_count mod (user_rec.lines div lines) = 0 then
- pause;
- end;
- end; {fname='' or equal names}
- end; {print out}
- end;
- end;
- if fname = '' then
- Dec(i)
- else
- begin
- NextKey(NewinName, i, key);
- if (Pos(fname, key) = 0) or (not OK) then
- i := -1;
- end;
- end;
- if (none_found) and (FileSize(nwin_file) > 1) then
- begin
- WriteLn(Com);
- WriteLn(Com, 'No file(s) found.');
- WriteLn(Com);
- end;
- if FileSize(nwin_file) = 1 then
- begin
- WriteLn(Com);
- WriteLn(Com, 'Newin List is empty.');
- WriteLn(Com);
- end;
- end;
-
-
- end. { of FILEMNU2.PAS }
-